FROM golang:alpine as builder
# 这份Dockerfile参考了ginvue项目
MAINTAINER kessil<http://gitee.com/kessil>
ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct \
    GO111MODULE=on \
    CGO_ENABLED=0
WORKDIR /home/ubuntu/gintify/serve
#VOLUME ["$WORKDIR/yamls"]
RUN go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
COPY . .
RUN go mod tidy && go build

FROM alpine:latest
LABEL MAINTAINER="kessil@outlook.com"
WORKDIR /home/ubuntu/gintify/serve
EXPOSE 5000
ENTRYPOINT ./gintify

# 根据Dockerfile生成Docker镜像
# docker build -t gintify .
# 根据Docker镜像启动Docker容器
# docker run -itd -p 8888:8888 --name gintify gintify
